Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

234
Visualizações
Why my subdirectory "/game" of the react website cannot be served from nginx?

I have a website with has one subdirectory named "/game". There is no problem when I click the tab in navbar when I execute the website in localhost (localhost:3000/game is working!). But when I want to access using my domain address, it gives me error "404 The requested page was not found." (mydomain/game is not working!)

What am I missing?

React Part - Navbar.js :

...

<a href="/game">
  <span>Game</span>
</a>

...

React Part - Game.js :

import React, { Component } from 'react'

export default class Game extends Component {
    render() {
        return (
            <div className='text-white text-center game'>
                GAME INFORMATION
            </div>
        )
    }
}

React Part - App.js :

function App() {
  return (
    <BrowserRouter>
      <Routes>
        <Route path="/" element={
          <div className="App">
            <header className='Main-header'>
              <Navbar />
              <Hero />
            </header>
            <About />
            <Gallery />
            <Faq />
          </div>
        } />
        <Route path="/game" element={<Game />} />
      </Routes>
    </BrowserRouter>
  );
}

export default App;

Nginx Part, after typing vi default :

server {
        listen 80 default_server;
        listen [::]:80 default_server;

        root /var/www/html;

        server_name _;

        location / {
                proxy_pass http://localhost:3000;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection 'upgrade';
                proxy_set_header Host $host;
                proxy_cache_bypass $http_upgrade;
        }
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Probably just an ssl error. Try to get a certificate from letsencrypt.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda